package com.xc.managersys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xc.managersys.mapper.SysUserMapper;
import com.xc.managersys.pojo.SysUser;
import com.xc.managersys.service.ISysUserService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author wzy
 * @since 2022-09-22
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {

    @Override
    public SysUser login(String username, String password) {

        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("login_name",username);

        SysUser sysUser = super.getOne(queryWrapper);

        if (sysUser == null){
            return null;
        }

        if (sysUser.getPassword().equals(password)){
            return sysUser;
        }

        return null;
    }
}
